<%@ page language="java" import="java.util.*,java.text.*" pageEncoding="utf-8"%>
<%@page import="issuedfileaction.DBConnection;"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>查询</title>
    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  
  <body>   
<%
  String dealercode=request.getParameter("dealercode");
  String dealername=new String(request.getParameter("dealername").getBytes("ISO-8859-1"),"gbk");
  String SelectName=request.getParameter("SelectName");
  String begintime=request.getParameter("begintime");
  String endtime=request.getParameter("endtime");
  String StrSql=" select dt_mdealercode,dt_mdealername,dt_mfilename,dt_mtype,dt_mtranstime,dt_misrepeat,dt_morigfilelines,dt_morigfilesum,dt_mfilepath,dt_mfiletype,dt_mid "
               +" from dtmonitor "
               +" where 1=1 ";
  if(!dealername.equals("")){
	  StrSql=StrSql+" and dt_mdealername='"+dealername.trim()+"' ";
  }
  if(!dealercode.equals("")){
	  StrSql=StrSql+" and dt_mdealercode='"+dealercode.trim()+"' ";
  }
  if(SelectName.trim().equals("2")){
     StrSql=StrSql+" and dt_mfiletype='2' ";     
  }else if(SelectName.trim().equals("3")){
     StrSql=StrSql+" and dt_mfiletype='3' ";
  }  
  StrSql = StrSql + " and (to_Date(to_char(dt_mtranstime,'YYYY-MM-DD'),'YYYY-MM-DD')>=to_Date('"+ begintime + "','YYYY-MM-DD') ";
  StrSql = StrSql + " and to_Date(to_char(dt_mtranstime,'YYYY-MM-DD'),'YYYY-MM-DD')<=to_Date('"+ endtime + "','YYYY-MM-DD')) ";
  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");	   
  HttpSession httpSession = request.getSession();
  DBConnection DB=new DBConnection();
  List<Object> ListRows = new ArrayList<Object>();
  ListRows=DB.SQLListExec(StrSql);	
  httpSession.setAttribute("filelist", ListRows);
  httpSession.setAttribute("beginDate", begintime);
  httpSession.setAttribute("endDate", endtime);
  httpSession.setAttribute("dealercode", dealercode);
  httpSession.setAttribute("dealername", dealername);  
  httpSession.setAttribute("filetype", SelectName.trim());
  httpSession.setAttribute("ReturnSQL", StrSql);
  httpSession.setAttribute("alertvalue","");			    	  
  response.sendRedirect("CheckIssue.jsp"); 
%>
  </body>
</html>
